Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Placement of variable definitions

Where you place variables in your code also makes a difference. Progress does a single pass through the statements in a procedure to build the intermediary code that it uses to execute the procedure. Because a variable is a definitional element of a procedure and not a statement that is executed in sequence, it does not really matter where the variable definition appears. However, because of the one-pass nature of the Progress syntax analyzer, the definition has to appear before the variable is used in the procedure. By convention, it is usually best for you to define all your variables at the top of a procedure, to aid in readability and to make sure that they’re all defined before they’re used.

For the next change to the test procedure, you will put to work several of the concepts you’ve just learned about. You will display a special value for each Order record. This task involves defining a variable with an initial value, writing an IF-THEN construct with a check for the Unknown value (?), and then using one of the many built-in Progress 4GL functions to extract a value to display. The value you will display is the ShipDate month of an Order expressed as a three-character abbreviation, such as JAN or FEB.

To build up the list of possible values for the month, you need to define a CHARACTER variable to hold the list. Add the following variable definition to the top of your procedure:

DEFINE VARIABLE cMonthList AS CHARACTER  NO-UNDO 
    INIT "JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC". 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095